package com.cdut.drivingschool.ui.main;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;

import com.cdut.drivingschool.R;
import com.cdut.drivingschool.util.ActivityUtil;
import com.cdut.drivingschool.util.AppUtil;

public abstract class BaseActivity extends Activity{
	private Context mContext;
	@Override
	protected void onDestroy() {
		super.onDestroy();
		/**将当前Activity重管理栈移出*/
		ActivityUtil.popActivity(this);
		mContext = this;
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		/**将当前Activity加入到管理栈*/
		ActivityUtil.pushActivity(this);
		initViews();
	}
	/**
	 * 设置Activity标题
	 */
	protected void setTitle(String title) {
		TextView mTitle = (TextView) findViewById(R.id.tv_title);
		mTitle.setText(title);
	}
	/**
	 * 显示toast消息
	 */
	protected void showToastMsg(String msg) {
		AppUtil.showToastMsg(this, msg);
	}
	protected Context getContext() {
		return mContext;
	}
	protected abstract void initViews();
}
